package com.ruoyi.thread;

import lombok.Data;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Data
public class LockTest2 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(200);
        for (int i = 0; i < 100000; i++) {
            Thread0926 thread = new Thread0926();
            executorService.execute(thread);
        }
        System.out.println(time);
    }

    private static int time = 0;
    private static Object lock = new Object();
    public void increase() {
        synchronized (lock) {
            time++;
        }
    }
}
